package org.lifeyears.web.action;

import java.util.Iterator;
import java.util.List;

import org.lifeyears.model.Project;
import org.lifeyears.services.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


/**
 * Actions regarding the page showing all projects in LifeYears.
 *
 */
@Scope( "prototype" )
@Component
public class ProjectsAction
	extends AbstractLifeyearsAction
{

	@Autowired
    private ProjectService projectService;

    @Override
    public String execute()
        throws Exception
    {
        return SUCCESS;
    }

    public Iterator <Project> getAllProjects()
    {
	final List allProjects = projectService.getAllList();
    	return allProjects.iterator();
    }
}
